package vg.services.graph_view_manager.realization.graph_view.smart_graph_view.realization.patches;

import vg.services.graph_layout_manager.interfaces.IGraphLayout;
import vg.services.graph_view_manager.interfaces.graph_view.graph_lib_depending.AMainGraphComponent;
import vg.services.graph_view_manager.realization.graph_view.smart_graph_view.interfaces.ISGVGraphView4Patching;
import vg.services.main_manager.MainManager;
import vg.services.progress_manager.interfaces.IProgressTask;

/**
 * This patch executes current layout.
 * @author Timur Zolotuhin (e-mail: tzolotuhin@gmail.com)
 */
public class ExecuteLayoutPatch extends DefaultPatch {
	public ExecuteLayoutPatch() {
		super("Execute layout");
	}
	
	@Override
	public void apply(ISGVGraphView4Patching graphView4patching) {
		AMainGraphComponent mainComp = graphView4patching.getMainGraphComponents();
        IGraphLayout layout = MainManager.graphLayoutManager.getCurrentLayout();

        // TODO FIX ME
        if (layout != null)
        	layout.execute(null, mainComp);
	}
	
	@Override
	public IProgressTask getProgressTask() {
		return null;
	}
}

